using IcsSEMCtrl.Global;
using IcsSEMCtrl.Service;
using IcsSEMCtrl.Service.Alarm;
using IcsSEMCtrl.Service.Device;
using IcsSEMCtrl.Service.EventBroker;
using IcsSEMCtrl.Service.Logger;
using IcsSEMCtrl.Service.Material;
using System;
using System.Collections.Generic;
namespace IcsSEMCtrl.Boot
{
	public class Launcher : ECPObject
	{
		private const string CLASS = "Launcher";
		private List<Manager> managers = new List<Manager>();
		private static Launcher launcher;
		public static Launcher GetLauncher()
        {
            if (launcher == null)
            {
				launcher = new Launcher();
            }
			return launcher;
        }
		public Launcher()
		{
			
		}
		public void LoadAllManagers()
		{
			this.managers.Add(new EventBrokerManager("launcher", "EventBrokerManager"));
			this.managers.Add(new CarrierManager("launcher", "CarrierManager"));
			this.managers.Add(new DeviceManager("launcher", "DeviceManager"));
			this.managers.Add(new AlarmManager("launcher", "AlarmManager"));
		}
		public Manager GetManager(string managerId)
		{
			lock (this)
			{
				Manager result;
				foreach (Manager current in this.managers)
				{
					if (current.GetId().Equals(managerId))
					{
						result = current;
						return result;
					}
				}
				result = null;
				return result;
			}
		}
		public override bool IsAlive()
		{
			return true;
		}
	}
}
